<!doctype html>
<html>
 
{include file="head.html"}

<body>
<div class="header" >
    <a href="{$appshop}?m=tejia"  class="left-btn"><span class="iconfont icon-back"></span></a>
    <div class="title">特价编辑</div>
    <a class="right-btn pointer" href="{$appshop}?m=tejia&a=add"><span class="iconfont icon-write"></span></a>
</div>
 
<form method="post" id="xform"   action="{$shopadmin}?m=tejia&a=save">
<input type="hidden" name="id" value="{$data.id}" />
 
<table width="100%" border="0" class="table table-bordered">
  <tr>
    <td width="60" align="right"> 标题：</td>
    <td  ><input name="title" type="text" id="title" value="{$data.title}" class="w98"></td>
  </tr>
  
  <tr>
  		<td align="right">类型：</td>
        <td> 
       	  <input type="radio" name="typeid" value="1" {if $data.typeid neq 2} checked{/if}> 只有一次
            <input type="radio" name="typeid" value="2" {if $data.typeid eq 2} checked{/if}> 每天一次
      </td>
  </tr>
     
  <tr>
	<td align="right">特价：</td>
    <td><input type="text" name="price" value="{$data.price}" class="w98"/></td>
</tr>

<tr>
	<td align="right">市场价：</td>
    <td><input type="text" name="market_price" value="{$data.market_price}" class="w98"/></td>
</tr>

<tr>
	<td align="right">库存数量：</td>
    <td><input type="text" name="total_num" class="w98" value="{$data.total_num}" /></td>
</tr>

<tr>
	<td align="right">限制购买量：</td>
    <td><input type="text" name="limit_num" class="w98" value="{$data.limit_num}" /></td>
</tr>

<tr>
          <td>开始时间：</td>
          <td><input type='text' name='starttime' id='starttime' value='{if $data.starttime}{$data.starttime|date:Y-m-d H:m:s}{/if}' onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" ></td>
        </tr>
        <tr>
          <td>结束时间：</td>
          <td><input type='text' name='endtime' id='endtime' value='{if $data.endtime}{$data.endtime|date:Y-m-d H:m:s}{/if}' onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" ></td>
        </tr>
 

  <tr>
              <td align="right">图片：</td>
              <td> <div id="up1" url="/index.php?m=upload&a=uploadtao&dir=tejia&id={$data.id}">
    	<div class="btn-upload">
          <input type="file" name="upimg" id="ud"  class="btn-upload-file" onChange="uploadimg('up1')">
         </div>
 
          <input type="hidden" name="imgurl" class="imgurl" value="{$data.imgurl}">
          <span class="imgShow">
          {if $data.imgurl}
          <img src="{$data.imgurl|images_site}.100x100.jpg">
          {/if}
          </span>
      </div></td>
    </tr>
  
  <tr>
  	<td>描述</td>
    <td ><div class="textarea-row"><textarea name="description" class="w98 h100">{$data.description}</textarea></div></td>
  </tr>
  
   
  <tr>
    
    <td colspan="2"><script type="text/html" name="content" id="content">{$data.content}</script></td>
  </tr>
   
 
</table>
 
<div class="form-btns">
 <button id="submit" type="button" name="button" class="btn btn-row btn-success" >提交</button> 
</div>
</form> 
  
  
{include file="footer.html"}
<script language="javascript" src="/plugin/My97DatePicker/WdatePicker.js"></script>
<script src="/plugin/skyweb/lrz.mobile.min.js"></script>
<script src="/static/js/upload_wap.js"></script>
{php loadEditor();} 
<script>
 
$(function(){
 var editor=UE.getEditor('content',options);
	$("#submit").bind("click",function(e){
	 
	 
		
		if($("#title").val()==""){
			$("#title").focus();
			skyToast('标题不能为空');
			return false;
		}
		
		$.post("{$appshop}?m=tejia&a=save&ajax=1",$("#xform").serialize(),function(data){
			if(data.error){
				skyToast(data.message);
			}else{
				skyToast('保存成功');
			}
		});
	});
});

</script>
</body>
</html>
